<template>
  <van-nav-bar
    :title="title"
    left-text="返回"
    left-arrow
    @click-left="onClickLeft"
  >
  </van-nav-bar>
  <van-cell-group>
    <van-cell is-link v-for="item in list" :key="item.sortid" @click="tolist(item)">
      <template #title>
        <van-badge :content="item.count"> {{item.cname}} </van-badge>
      </template>
    </van-cell>
  </van-cell-group>
</template>

<script setup>
import { useRoute, useRouter } from "vue-router";
import { reactive, ref, onMounted } from "vue";
import { getcataloglist } from "../api/emr";
const router = useRouter();

const selectitem = JSON.parse(localStorage.getItem("selectitem"));
const title = selectitem.name + selectitem.age + "岁";
function onClickLeft() {
  //返回上一页
  router.back();
}
const list = ref([]);
getcataloglist({
  id: selectitem.id,
}).then((res) => {
  if (res.code == 0) {
    list.value = res.data;
  } else {
    this.$toast.fail(res.msg);
  }
});
function tolist(item) {
   router.push({
    name: 'emrlist', 
    params: {
      id: item.sortid
    }
  })
}
</script>

<style></style>
